//环境配置
import 'dart:io';

enum env {
  debug,
  test,
  prod,
}
//当前环境
env environment = env.test;

//项目服务地址
final Map<env, String> _httpServerMap = {
  env.debug: 'http://192.168.1.117:30050',
  env.test: 'http://www.baidu.com',
  env.prod: 'https://www.baidu.com',
};

final _androidBaidu = {
  'appId': '123456',
  'appKey': '123456',
  'appSecret': '123456',
};

final _iosBaidu = {
  'appId': '123456',
  'appKey': '123456',
  'appSecret': '123456',
};

final _currentBaidu = Platform.isAndroid ? _androidBaidu : _iosBaidu;

final String _httpServer = _httpServerMap[environment];

class Constant {
  //项目服务地址
  static final String httpServer = _httpServer;

  //请求数据失败提示（页面）
  static final String httpErrText = '数据加载失败';

  //请求数据失败提示（吐司）
  static final String httpServeErrText = '未知异常';

  //缓存登录用户信息key
  static final String spLoginData = 'loginData';

  //缓存登录用户pas name
  static final String spLoginPas = 'loginPas';

  //缓存搜索菜品key
  static final String spSearchCommodity = 'searchCommodityHistory';

  //第一次
  static final String spFirst = "isFirst";

  //分页查询每页数量
  static const int rows = 10;

  //APP版本号
  static String appVersion;

  //极光推送
  static String jPushId;
  static String jPushAppKey = '123456';

  //UUID
  static String uuid;

  //服务协议地址
  static final String serviceAgreement = 'http://www.baidu.com';

  //隐私档案地址
  static final String privacyAgreement = 'http://www.baidu.com';

  //错误上报邮箱
  static final String crashEmail = 'wangkai233@qq.com';

  //ios端appStore ID
  static final String iosAppStoreID = '123456';

  //百度
  static final String baiduApiKey = _currentBaidu['appKey'];
  static final String baiduSecretKey = _currentBaidu['appSecret'];
  static final String baiduAppId = _currentBaidu['appId'];

  //高德地图
  static final String amapIosKey = '123456';
  static final String amapAndroidKey = '123456';

  //堂食、外卖
  static CommodityType commodityType;

  //是否为外卖
  static bool get isTakeout => commodityType == CommodityType.takeout;

  static String wxAppId = 'wx23333333';
  static String wxUniversalLink = 'http://www.baidu.com';
}

enum CommodityType {
  tang,
  takeout,
}
